import 'dart:convert';

import 'package:flutter_oldman_health/widget/listener_container.dart';

class RemoteControlConnectionModel {
  String msgType = "CreateRemoteControlConnection";
  String msgId = DateTime.now().microsecondsSinceEpoch.toString();
  String sessionId;
  String userId;
  String noNeedAgree;

  RemoteControlConnectionModel({this.userId, this.noNeedAgree, this.sessionId});

  Map<String, dynamic> toJson() => {
        "msgType": msgType,
        "userId": userId,
        "msgId": msgId,
        "noNeedAgree": noNeedAgree,
        "sessionId": sessionId,
      };
}

class SendRemoteControlMsgModel {
  String msgType = "controller";
  String userId;
  String channelId;

  SendRemoteControlMsgModel({this.userId, this.channelId});

  Map<String, dynamic> toJson() => {
        "msgType": msgType,
        "userId": userId,
        "channelId": channelId,
      };
}

class SendCaptureScreenMsgModel {
  String msgType = "CaptureScreen";
  String msgId;
  String config;

  SendCaptureScreenMsgModel({this.msgId});

  Map<String, dynamic> toJson() => {
        "msgType": msgType,
        "msgId": msgId,
        "config": ScreenModel().toJson().toString(),
      };
}

class PingTimeMsgModel {
  String msgType = "Ping";
  String msgId;
  String pingTime;

  PingTimeMsgModel() {
    msgId = DateTime.now().microsecondsSinceEpoch.toString();
  }

  Map<String, dynamic> toJson() => {
        "msgType": msgType,
        "msgId": msgId,
        "pingTime": DateTime.now().microsecondsSinceEpoch.toString(),
      };
}

class ScreenModel {
  String format = "jpg";
  int quality = 75;

  Map<String, dynamic> toJson() => {
        "format": format,
        "quality": quality,
      };
}

class SendTouchScreenModel {
  String msgId;
  int eventType;
  int index;
  ScreenPoint point;

  SendTouchScreenModel(
      {this.msgId, this.eventType, this.index, this.point});

  Map<String, dynamic> toJson() => {
        "msgType": "TouchScreen",
        "msgId": msgId,
        "eventType": eventType,
        "index": index,
        "point": json.encode(point),
      };
}
